#ifndef _SERIAL_H
#define _SERIAL_H

#include <list.h>

#define SERIAL_NAME_MAX_LEN	(16)

struct serial_device {
	struct list_head list;
    char name[SERIAL_NAME_MAX_LEN];
    int (*init) (void);
    int (*setbrg) (unsigned int);
    int (*getc) (void);
    int (*tstc) (void);
    void (*putc) (const char);
    void (*puts) (const char *);
};

/*
extern struct list_head serial_devices;
extern struct serial_device *serial_current;

int serial_register(const char *name, struct serial_device *dev);
int serial_set_current(const char *name);
*/
//int serial_init(void);
//int serial_setbrg(unsigned int baudrate)
//int serial_getc(void);
//int serial_tstc(void);
//void serial_putc(const char c);
//void serial_puts(const char *s);

enum uarts {
	UART0	= 0,
	UART1	= 1,
	UART2	= 2
};

void serial_init(uint32_t uart, uint32_t baud);
void serial_putc(uint32_t uart, uint8_t c);
void serial_puts(uint32_t uart, const char* s);
uint8_t serial_getc(uint32_t uart);

#endif /* _SERIAL_H */

